package com.yxkj.syh.app.huarong.activities.account.forgot_pwd.reset;

import android.app.Application;
import android.text.TextUtils;

import androidx.annotation.NonNull;
import androidx.databinding.ObservableField;

import com.syh.app.basic.base.view_model.BaseViewModel;
import com.trello.rxlifecycle2.android.ActivityEvent;

/**
 * 创建者：SYH
 * 时间：2020/5/19 15:37
 * 编辑者：SYH、
 * 标签：
 * 补充说明：
 */
public class ResetPwdVM extends BaseViewModel<ActivityEvent> {
    public ResetPwdVM(@NonNull Application application) {
        super(application);
    }

    public ObservableField<String> ofNewPwd = new ObservableField<String>(){
        @Override
        public void set(String value) {
            super.set(value);
            if (!TextUtils.isEmpty(value) && !TextUtils.isEmpty(ofPwd.get())) {
                if (!ofResetEnable.get()) {
                    ofResetEnable.set(true);
                }
            } else {
                if (ofResetEnable.get()) {
                    ofResetEnable.set(false);
                }
            }
        }
    };
    public ObservableField<String> ofPwd = new ObservableField<String>(){
        @Override
        public void set(String value) {
            super.set(value);
            if (!TextUtils.isEmpty(value) && !TextUtils.isEmpty(ofNewPwd.get())) {
                if (!ofResetEnable.get()) {
                    ofResetEnable.set(true);
                }
            } else {
                if (ofResetEnable.get()) {
                    ofResetEnable.set(false);
                }
            }
        }
    };
    public ObservableField<Boolean> ofResetEnable = new ObservableField<>(Boolean.FALSE);


}
